﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../../Scripts/jquery-2.0.0.min.js" type="text/javascript"></script>
    <script src="../../Scripts/underscore.js" type="text/javascript"></script>
    <script src="../../Scripts/backbone.js" type="text/javascript"></script>
</head>
<body>
    <span>raly</span>
</body>
<script type="text/javascript">

    var BaseModel = Backbone.Model.extend({
        _ref: '',
        _refObjectName: ''
    });

    var Workspace = BaseModel.extend({});

    var WorkspaceCollection = Backbone.Collection.extend({
        model: Workspace,
        url: 'https://rally1.rallydev.com/slm/webservice/1.43/workspace/9788620910.js',
        sync: function (method, model, options) {
            var params = _.extend({
                type: "get",
                url: this.url,
                async: false,
                dataType: "jsonp",
                jsonp: "jsonp"
            }, options);

            return $.ajax(params);
        },
        parse: function (response) {
            console.log(response);
            return response;
        }
    });
    var ProjectView = new Backbone.View.extend({
        tagName: 'select',
        className: 'projects',
        render: function () {
            var template = _.template(this.template, model);
            this.$el.html(template);
            return this;
        }
    });

    var t, view;
    $(function () {
        t = new WorkspaceCollection();
        t.fetch({
            success: function () {
                view = new ProjectView({ model: t.at(0).get('Workspace').Projects });
            }
        });
});
    


</script>
</html>
